package com.hakim.wfb.customer.enums;

/**
 * Created by walkman on 2017/7/9.
 */
public enum PacketBoundStatusEnum {

    UNBOUND(1, "未绑定"),
    BOUND(2, "已绑定"),
    DISBOUND(3, "已解绑");

    private Integer code;
    private String value;

    PacketBoundStatusEnum() {
    }

    PacketBoundStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static PacketBoundStatusEnum getByCode(Integer code) {
        for (PacketBoundStatusEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static PacketBoundStatusEnum getByValue(int value) {
        PacketBoundStatusEnum[] codes = values();
        for (PacketBoundStatusEnum each : codes) {
            if (each.code == value) {
                return each;
            }
        }
        return null;
    }

}
